//
//  GradientBackgroundStyle.swift
//  SwiftUICode
//
//  Created by yangkl on 2024/2/19.
//

import Foundation
import SwiftUI


struct GradientBackgroundStyle: ButtonStyle{
    
    func makeBody(configuration: Configuration) -> some View {
        configuration.label
            .frame(minWidth: 0, maxWidth: .infinity)
            .padding()
            .foregroundColor(.white)
            .background(LinearGradient(gradient: Gradient(colors: [Color.red, Color.blue]), startPoint: /*@START_MENU_TOKEN@*/.leading/*@END_MENU_TOKEN@*/, endPoint: .trailing))
            .cornerRadius(40)
            .padding(.horizontal)
            .scaleEffect(configuration.isPressed ? 0.95 : 1)
//            .rotationEffect(configuration.isPressed ? .degrees(135): .zero)
        
    }
}
